//
//  taobaoke_item.m
//  yuimall_Iphone
//
//  Created by yuike6 yuike6 on 12-4-16.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

#import "taobaoke_item.h"
#import "header.h"

@implementation taobaoke_item
@synthesize commission_rate;
@synthesize num_iid;

@synthesize title;
@synthesize nick;

@synthesize pic_url;
@synthesize price;

@synthesize click_url;
@synthesize commission;

@synthesize commission_num;
@synthesize commission_volume;

@synthesize shop_click_url;
@synthesize seller_credit_score;

@synthesize item_location;
@synthesize volume;

-(void) dealloc
{
    YRelease(commission_rate)
    YRelease(num_iid)
    
    YRelease(title)
    YRelease(nick)
    
    YRelease(pic_url)
    YRelease(price)
    
    YRelease(click_url)
    YRelease(commission)
    
    YRelease(commission_num)
    YRelease(commission_volume)
    
    YRelease(shop_click_url)
    YRelease(seller_credit_score)
    
    YRelease(item_location)
    YRelease(volume)
    
    [super dealloc];
}



-(void) privateInit
{
    self.commission_rate = [self.xmlTree valueAtPath:@"taobaoke_item/commission_rate"];
    self.num_iid = [NSNumber numberWithDouble:[[self.xmlTree valueAtPath:@"taobaoke_item/num_iid"] doubleValue]];
    
    self.title = [self.xmlTree valueAtPath:@"taobaoke_item/title"];
    self.nick = [self.xmlTree valueAtPath:@"taobaoke_item/nick"];
    
    self.pic_url = [self.xmlTree valueAtPath:@"taobaoke_item/pic_url"];
    
    Price * tmp_price = [[Price alloc]initWithXmlTree:[self.xmlTree parsedTreeAtPath:@"item/price"]];
    self.price = tmp_price;
    YRelease(tmp_price);
    
    self.click_url = [self.xmlTree valueAtPath:@"taobaoke_item/click_url"];
    
    Price * tmp_commission = [[Price alloc]initWithXmlTree:[self.xmlTree parsedTreeAtPath:@"item/commission"]];
    self.commission = tmp_commission;
    YRelease(tmp_commission);
    
    self.commission_num = [self.xmlTree valueAtPath:@"taobaoke_item/commission_num"];
    self.commission_volume = [self.xmlTree valueAtPath:@"taobaoke_item/commission_volume"];
    
    self.shop_click_url = [self.xmlTree valueAtPath:@"taobaoke_item/shop_click_url"];
    self.seller_credit_score = [NSNumber numberWithDouble:[[self.xmlTree valueAtPath:@"taobaoke_item/seller_credit_score"] doubleValue]];
    
    self.item_location = [self.xmlTree valueAtPath:@"taobaoke_item/item_location"];
    self.volume = [NSNumber numberWithDouble:[[self.xmlTree valueAtPath:@"taobaoke_item/volume"] doubleValue]];
}

-(id) initWithXmlTree:(XMLParsedTree *)tree
{
    self = [super initWithXmlTree:tree];
    if (self) {
        [self privateInit];
    }
    
    return self;
}


-(id) initWithXmlString:(NSString *)xmlString
{
    self = [super initWithXmlString:xmlString];
    if (self) {
        [self privateInit];
    }
    return self;
}

-(id) initWithXmlData:(NSData *)xmlData
{
    self = [super initWithXmlData:xmlData];
    if (self) {
        [self privateInit];
    }
    return self;
}
@end
